package top.tangyh.lamp.care.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import top.tangyh.lamp.care.entity.HisPatientEvent;
import top.tangyh.lamp.care.entity.IcuOnlinePatients;
import top.tangyh.lamp.care.mapper.HisPatientEventMapper;
import top.tangyh.lamp.care.mapper.IcuOnlinePatientsMapper;
import top.tangyh.lamp.care.service.HisPatientEventService;
import top.tangyh.lamp.care.service.IcuOnlinePatientsService;

import java.util.List;

/**
 * @author: zqb
 * @date: 2024/12/17 18:48
 */
@Service
@RequiredArgsConstructor
@DS("mysql")
public class HisPatientEventServiceImpl extends ServiceImpl<HisPatientEventMapper, HisPatientEvent> implements HisPatientEventService {
    private final HisPatientEventMapper hisPatientEventMapper;

    @Override
    public List<HisPatientEvent> getHisPatientEventListBy(String hospitalNumber) {
        LambdaQueryWrapper<HisPatientEvent> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(HisPatientEvent::getHospitalNumber, hospitalNumber)
                .orderByDesc(HisPatientEvent::getRecordTime); // 按recordTime降序排序;
        return hisPatientEventMapper.selectList(queryWrapper);
    }
}
